<?php
/**
 * Created by PhpStorm.
 * User: godjarvis
 * Date: 2020/08/05
 * Time: 16:16
 */

namespace App\Model\Entity\DangKou;

use Fresh\Mvc\Model\Entity;
use Fresh\Annotation\EntitySetting;

/**
 * @EntitySetting(tableName="product", connection="dangkou")
 */
class Product extends Entity
{
    // 售卖状态
    const SELL_DISCARDED = -2;//作废
    const SELL_PENDING = -1;//待审
    const SELL_STOPPED = 0;//停售
    const SELL_PREPARING = 1;//待售
    const SELL = 2;//在售
    const SELL_STOPPING = 3;//将售罄

    // 排序方式
    const SORT_DATE = 1;
    const SORT_HOT = 2;
    const SORT_STOCK = 3;
    const SORT_PRICE_DESC = 4;
    const SORT_PRICE_ASC = 5;
    const SORT_PROMOTION = 6;
    const SORT_SPECIAL = 7;

    // 季节
    const SEASON_SPRING = 2;
    const SEASON_SUMMER = 3;
    const SEASON_AUTUMN = 4;
    const SEASON_WINTER = 1;

    // 专业推荐
    const PRODUCT_TYPE_RESERVE = 1;
    const PRODUCT_TYPE_PRESENT = 2;

    const RECOMMEND_TYPE_NEW = 1; //新款
    const RECOMMEND_TYPE_FIRE = 2; //爆款
    const RECOMMEND_TYPE_PROMOTION = 3; //促销
    const RECOMMEND_TYPE_SPECIAL = 4; //白菜

    public static function seasonText()
    {
        return [
            self::SEASON_SPRING => '春',
            self::SEASON_SUMMER => '夏',
            self::SEASON_AUTUMN => '秋',
            self::SEASON_WINTER => '冬',
        ];
    }

    public static function sortText()
    {
        return [
            self::SORT_DATE => '上新',
            self::SORT_HOT => '热卖',
            self::SORT_STOCK => '现货',
            self::SORT_PRICE_DESC => '价格倒序',
            self::SORT_PRICE_ASC => '价格升序',
            self::SORT_PROMOTION => '促销',
            self::SORT_SPECIAL => '特价',
        ];
    }

    public function sallText()
    {
        return [
            self::SELL_DISCARDED => '作废',
            self::SELL_PENDING => '待审',
            self::SELL_STOPPED => '停售',
            self::SELL_PREPARING => '待售',
            self::SELL => '在售',
            self::SELL_STOPPING => '将售罄',
        ];
    }
}
